//
//  RJHomeMapVC.m
//  AirQuality
//
//  Created by Po on 15/6/8.
//  Copyright (c) 2015年 Po. All rights reserved.
//

#import "RJHomeMapVC.h"
#import "RJHomeTopView.h"
#import "RJOutVC.h"
@interface RJHomeMapVC ()<RJHomeTopViewDelegate>

@property (retain, nonatomic) RJHomeTopView * topView;                  //上方视图

@end

@implementation RJHomeMapVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setFrame:CGRectMake(0, sysNavBarHeight, ScreenWidth, ScreenHeight - sysNavBarHeight - sysTabbarHeight)];
    [self getTopView];
}

#pragma mark - delegate
- (void)netRequestFailure
{
    [RJTools showTitle:@"网络异常" msg:@"网络异常，请点击重试！" cancelString:@"取消" confirmString:@"重试" confirmBlock:^{
        [_topView netRetry];
    } vc:self];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [_topView mapViewDisappear];
    
}

#pragma mark - function
- (void)reloadView
{
    [_topView reloadView];
}

#pragma mark - getter
/**获得上部视图，没有就初始化*/
- (RJHomeTopView *)getTopView
{
    if (!_topView) {
        _topView = [[RJHomeTopView alloc] initWithFrame:self.view.bounds];
        [_topView setDelegate:self];
        [self.view addSubview:_topView];
    }
    return _topView;
}

- (void)touchPaoPaoView:(NSString *)cityName
{
//    RJOutVC * outVC = [[RJOutVC alloc] init];
//    outVC.paopaoName = cityName;
//    outVC.view.frame = CGRectMake(0, sysNavBarHeight, ScreenWidth, ScreenHeight - sysNavBarHeight - sysTabbarHeight);
//    [self.navigationController pushViewController:outVC animated:YES];
    [RJUserData defaultRJUserData].paoPaoName = cityName;
    [[NSNotificationCenter defaultCenter] postNotificationName:@"selectPao" object:cityName];
}

@end
